package com.lovo.invoicing.utils;

import com.lovo.invoicing.bean.MessageCode;

public class RUtils {
    /*成功，且返回体有数据*/
    public static ResponseResult success(Object object) {
        ResponseResult r = new ResponseResult();
        r.setCode(MessageCode.SUCCESS.getCode());
        r.setMsg(MessageCode.SUCCESS.getMsg());
        r.setData(object);
        return r;
    }
    //成功，但返回体没数据
    public static  ResponseResult success(){
        return success(null);
    }
    //失败返回信息
    public static ResponseResult fail(){
        ResponseResult r = new ResponseResult();
        r.setCode(MessageCode.FAIL.getCode());
        r.setMsg(MessageCode.FAIL.getMsg());
        return r;
    }
    //错误返回信息
    public static ResponseResult err(){
        ResponseResult r = new ResponseResult();
        r.setCode(MessageCode.ERROR.getCode());
        r.setMsg(MessageCode.ERROR.getMsg());
        return r;
    }

}
